/*
 * @Author: your name
 * @Date: 2020-04-27 13:53:50
 * @LastEditTime: 2020-05-14 18:58:02
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \rec_rec\platform\cva\read_ps_file.h
 */

#ifndef __TINYBEAR_READ_PS_FILE_H_
#define __TINYBEAR_READ_PS_FILE_H_
#include <stdio.h>


typedef enum  _e_ps_type
{
	ps_type_video = 0x01,
	ps_type_audio = 0x02,
	ps_type_mix = 0x03
}e_ps_type;

typedef struct
{

	unsigned len;                 //! Length of the NAL unit (Excluding the start code, which does not belong to the NALU)
	unsigned max_size;            //! Nal Unit Buffer size
	char *buf;                    //! contains the first byte followed by the EBSP

	e_ps_type video_audio;
	double v_pts;
	double a_pts;


	FILE *psbitstream;
	int ps_proc_init;

	unsigned long start_offset_sec;
	unsigned long end_offset_sec;

	unsigned long total_offset;
	int ps_num;

} PS_t;



#define PS_MAX_LEN (1<<20)
int ps_read_init(PS_t *ps_unit, char *file_name);
int ps_read_one_frame(PS_t *ps_unit,char **out_buf,int *out_len);
int ps_read_deinit(PS_t *ps_unit);
int my_ps_prase(const char *file_in,const char *file_out);
long long get_offset_by_sec(char *file_name,char *detail_name,int sec_offset,int start);
#endif	//__TINYBEAR_READ_PS_FILE_H_